package src.main.danli;

/**
 * 懒汉单例 加锁
 */
public final class IdlerSingleInner {
    private static volatile IdlerSingleInner instance;
    public static int value=1;


    public static IdlerSingleInner getInstance() {
//        IdlerSingleInner result = instance;
//        if (result != null) {
//            return result;
//        }

        if(instance==null) {
            synchronized (IdlerSingleInner.class) {
                if (instance == null) {
                    instance = new IdlerSingleInner();
                    value+=1;
                }
            }
        }
        return instance;
    }

}
